package com.wxy.learn.classLoad;

/**
 * Parent: 父类
 *
 * @author wxy
 * @since 2023-01-08
 */
public class Parent {
    private static int serialNumber = 0;

    public static final String PUB_ATTR = printAndReturn("parent public static attr");

    private static final String PRI_ATTR = printAndReturn("parent private static attr");

    public Parent() {
        printAndReturn("parent construct");
    }

    static {
        printAndReturn("parent static code block");
    }

    {
        printAndReturn("parent anonymous inner class");
    }

    private final String code = printAndReturn("parent member variable code");

    /**
     * 打印str参数
     *
     * @param str 需要打印的值
     */
    public static String printAndReturn(String str) {
        System.out.println(++serialNumber + ". " + str);

        return str;
    }
}
